﻿Ext.define('Examples.order.order.view.Grid', {
    extend: 'Happy.grid.Panel',
    alias: 'widget.order-grid',
    requires: [
        'Happy.table.action.Refresh',
        'Happy.table.action.New',
        'Happy.table.action.Edit',
        'Happy.grid.action.Delete',
        'Examples.order.order.store.Store',
        'Examples.order.order.view.Form'
    ],

    columns: [
        { text: 'Customer', dataIndex: 'Customer' }
    ],

    initComponent: function () {
        var me = this;

        me.store = Ext.create('Examples.order.order.store.Store', {
            autoLoad: true
        });

        me.tbar = Happy.createActions([
            'refresh',
            {
                type: 'new',
                showStrategy: {
                    title: 'new form',
                    formType: 'order-form'
                }
            },
            {
                type: 'edit',
                showStrategy: {
                    title: 'edit form',
                    formType: 'order-form'
                }
            },
            'grid-delete'
        ]);

        me.callParent(arguments);
    }
});